#pragma once
#ifndef CLIB_SIGNAL_H
#define CLIB_SIGNAL_H

#include "clib_type.h"

#ifdef __cplusplus
extern "C" {
#endif

#define CLIB_HANDLE_MAX     16

typedef struct clib_signal_s clib_signal_t;

typedef i32_t (*signal_fn)(i32_t signo);

typedef enum
{
    clib_signo_type_ignore = 0,
    clib_signo_type_exit   = 1,
} clib_signo_type_t;

struct clib_signal_s {
    i32_t           signo;
    const char      *signame;
    const char      *name;
    signal_fn       call[CLIB_HANDLE_MAX];
};

i32_t
clib_register_signal(i32_t signo,signal_fn handle);

void
clib_register_signal_by_cfg(clib_signal_t *signal,i32_t nums);

void
clib_init_signal();


#ifdef __cplusplus
}
#endif

#endif